@layout("/common/_container.html"){
<div class="layui-card">
  <div class="layui-card-header">修改密码</div>
  <div class="layui-card-body">
    
    <div class="layui-form" lay-filter="">
    	<div class="layui-form-item">
    		<label class="layui-form-label">登录名</label>
    		<div class="layui-input-inline">
    			<div class="layui-form-mid">${admin.account}</div>
    		</div>
      </div>
    	<div class="layui-form-item">
    		<label class="layui-form-label">邮箱账号</label>
    		<div class="layui-input-inline">
    			<div class="layui-form-mid">${admin.email}</div>
    		</div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">原始密码</label>
        <div class="layui-input-inline">
          <input type="password" id="oldPwd" name="oldPwd" lay-verify="required"  class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">新建密码</label>
        <div class="layui-input-inline">
          <input type="password" id="newPwd" name="newPwd" lay-verify="pass"  autocomplete="off"  class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">密码必须6到12位，且不能出现空格</div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-inline">
          <input type="password" id="rePwd" name="rePwd" lay-verify="required|repass" autocomplete="off" class="layui-input">
        </div>
      </div>
      @if(kaptcha.getKaptchaOnOff()==true){
      <div class="layui-form-item">
      	<label class="layui-form-label">验证码</label>
      	<div class="layui-input-inline">
      		<input type="text" lay-verify="required" name="kaptchas" id="kaptchas" autocomplete="off" class="layui-input">
      	</div>
	          <img src="${ctxPath}/kaptcha"  id="kaptcha" style="height:38px">
	    </div>
	    @}
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit onclick="chPwd()">确认修改</button>
        </div>
      </div>
    </div>
    
  </div>
</div>
<script src="${ctxPath}/static/modular/system/user/user_info.js"></script>

<script>
layui.config({
	base: Feng.ctxPath +'/static/layuiadmin/' //静态资源所在路径
}).extend({
	index: 'lib/index' //主入口模块
}).use(['index', 'form','laydate','util','verify'], function(){
    var $ = layui.$
    ,form = layui.form
    ,laydate = layui.laydate
    ,util = layui.util;
    
});

$(function () {
    $("#kaptcha").on('click', function () {
        $("#kaptcha").attr('src', '${ctxPath}/kaptcha?' + Math.floor(Math.random() * 100)).fadeIn();
    });
});

function chPwd(){
	var ajax = new $ax(Feng.ctxPath + "/admin/password/update", function (data) {
        Feng.success("修改成功!");
    }, function (data) {
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set("oldPwd");
    ajax.set("newPwd");
    ajax.set("rePwd");
    ajax.set("kaptchas");
    ajax.start();
}
</script>
@}

